<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
    <meta http-equiv="Pragma" content="no-cache">
    <meta http-equiv="Cache" content="no-cache">
    <meta http-equiv="Cache-Control" content="no-cache, must-revalidate">
    <meta http-equiv="expires" content="0">
    <title>参与记录</title>
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap.min.css">
    <link rel="stylesheet" href="bootstrap/css/bootstrap-theme.min.css">
    <link rel="stylesheet" href="css/index.css">
    <style>
        td>img{
            height: 30px;
            width: 30px;
        }
    </style>
</head>
<body>
<div>
    <table class="table table-striped" id="record" style="word-break: break-all;table-layout: fixed;">
        <tr>
            <th style="width: 40px">#</th>
            <th>微信昵称</th>
            <th style="width: 80px">抽奖号码</th>
            <th style="width: 100px">参与时间</th>
        </tr>
<!--        <tr><td><img src="img/tmp/首页商品.png" alt="" /></td><td>小黑</td><td>549216</td><td>2019-10-08</td></tr>-->
<!--        <tr><td><img src="img/tmp/首页商品.png" alt="" /></td><td>小黑</td><td>549216</td><td>2019-10-08</td></tr>-->
<!--        <tr><td><img src="img/tmp/首页商品.png" alt="" /></td><td>小黑</td><td>549216</td><td>2019-10-08</td></tr>-->
    </table>
</div>
<script src="js/jquery.js"></script>
<script src="bootstrap/js/bootstrap.min.js"></script>
<script src="https://res.wx.qq.com/open/js/jweixin-1.4.0.js"></script>
<script src="js/sha1.js"></script>
<script src="js/config.js"></script>
<script src="js/public2.js"></script>
<script type="text/javascript">
    let act_id = getQueryVariable('act_id');
    let page_no = 1;
    let page_size = 100;
    if(!act_id){
        alert('未传参数');
        location.replace('./index.html');
    }

    function afterVerify() {
        loadData();
    }

    function loadData(){
        $.post(baseUrl+'client/participate/record',{
            act_id:act_id,
            page_no:page_no,
            page_size:page_size,
        },function(result){
            if(result.code === 0){
                let record = '';
                let info = result.data.info;
                for(let i=0;i<result.data.info.length;i++){
                    record += '<tr>';
                    record += '<td><img src="'+info[i].headimgurl+'" alt="" /></td>';
                    record += '<td>'+info[i].nickname+'</td>';
                    record += '<td>'+info[i].code+'</td>';
                    record += '<td>'+info[i].date+'</td>';
                    record += '<tr>';
                }
                $('#record').append(record);
            }else{
                alert(result.msg);
            }
            page_no++;
        },'json');
    }


    function getScrollTop(){
        var scrollTop = 0, bodyScrollTop = 0, documentScrollTop = 0;
        if(document.body){
            bodyScrollTop = document.body.scrollTop;
        }
        if(document.documentElement){
            documentScrollTop = document.documentElement.scrollTop;
        }
        scrollTop = (bodyScrollTop - documentScrollTop > 0) ? bodyScrollTop : documentScrollTop;
        return scrollTop;
    }
    //文档的总高度
    function getScrollHeight(){
        var scrollHeight = 0, bodyScrollHeight = 0, documentScrollHeight = 0;
        if(document.body){
            bodyScrollHeight = document.body.scrollHeight;
        }
        if(document.documentElement){
            documentScrollHeight = document.documentElement.scrollHeight;
        }
        scrollHeight = (bodyScrollHeight - documentScrollHeight > 0) ? bodyScrollHeight : documentScrollHeight;
        return scrollHeight;
    }
    //浏览器视口的高度
    function getWindowHeight(){
        var windowHeight = 0;
        if(document.compatMode == "CSS1Compat"){
            windowHeight = document.documentElement.clientHeight;
        }else{
            windowHeight = document.body.clientHeight;
        }
        return windowHeight;
    }


    window.onscroll = function() {
        if (getScrollTop() + getWindowHeight() == getScrollHeight()) {
            loadData();
        }
    }
</script>
<script src="js/verify.js"></script>
</body>
</html>